package top.wshape1.rpc.registry;

import top.wshape1.rpc.common.entity.ServiceMeta;

import java.util.List;

/**
 * @author Wshape1
 * @version 1.0
 * @description Rpc Registry
 * @since 2024-02-02
 */

public interface RpcRegistry {

    /**
     * register service
     *
     * @param serviceMeta service meta
     */
    void register(ServiceMeta serviceMeta);

    /**
     * unregister service
     *
     * @param serviceMeta service meta
     */
    void unregister(ServiceMeta serviceMeta);

    /**
     * lookup service
     *
     * @param serviceName service name
     * @return a list of ServiceMeta
     */
    List<ServiceMeta> lookup(String serviceName);

    /**
     * subscribe service
     *
     * @param serviceName service name
     */
    void subscribe(String serviceName);

    /**
     * unsubscribe service
     *
     * @param serviceName service name
     */
    void unsubscribe(String serviceName);

    /**
     * destroy registry
     */
    void destroy();

}
